Skip to content

docs: clarify FlatList extraData prop and PureComponent behavior (fixes #5216) - #5282

Merged
Simek merged 1 commit into
react:mainfrom
supunyasanthaofficial:fix/flatlist-extradata-example
Oct 19, 2026
Merged

Simek merged 1 commit into
react:mainfrom
supunyasanthaofficial:fix/flatlist-extradata-example

Conversation

@supunyasanthaofficial

Copy link
Copy Markdown
Contributor

Summary

Fixes #5216.

Clarifies how extraData works in the selectable FlatList example in docs/flatlist.md. The change is also applied to the versioned docs from 0.77 through 0.87.

Changes

  • Explained that extraData tells FlatList when it needs to account for changes in data outside its data prop.
  • Clarified that FlatList uses shallow prop comparison, so extraData is important when renderItem doesn't change its reference but depends on external state.
  • Removed the ambiguous use of "we" to follow the documentation style guide.

Test Plan

  • Ran npx eslint docs/flatlist.md with no errors.
  • Checked formatting across the versioned docs from 0.77 through 0.87.

@meta-cla meta-cla Bot added the CLA Signed label Oct 14, 2026
@theprantadutta

Copy link
Copy Markdown
Contributor

I'd looked into #5216 earlier, so I checked this against the source: FlatList extends React.PureComponent (FlatList.js). So with a stable renderItem and unchanged data, the shallow prop check skips the re-render entirely, and extraData is what gets it through. The wording here is right.

It also corrects something in my comment on the issue: I tied the stable-renderItem case to strictMode, which was too narrow. strictMode just adds a second memoization layer on top, and the PureComponent check applies either way.

This is from reading the source, not a device run.

@supunyasanthaofficial

supunyasanthaofficial commented Oct 19, 2026 via email

Copy link
Copy Markdown
Contributor Author

@Simek Simek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @supunyasanthaofficial for updating the docs, and @theprantadutta for confirmation and verification! 👍

@Simek
Simek merged commit 26aec57 into react:main Oct 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example showing need for FlatList extraData prop is misleading

3 participants